package com.leenmvc.core.security.entity.core;

import com.leenmvc.core.annotation.DbInfo;
import com.leenmvc.core.annotation.FillField;
import com.leenmvc.core.annotation.PrimaryKey;
import com.leenmvc.core.annotation.TableField;
import com.leenmvc.core.annotation.validator.Exist;
import com.leenmvc.core.annotation.validator.Uniqueness;
import com.leenmvc.core.annotation.validator.groups.AddGroup;
import com.leenmvc.core.annotation.validator.groups.DeleteGroup;
import com.leenmvc.core.annotation.validator.groups.UpdateGroup;
import com.leenmvc.core.enums.FillType;
import com.leenmvc.core.security.dao.core.SysRoleUserDao;
import com.leenmvc.core.utils.collection.TreeNode;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 角色
 *
 * @author leen
 */
@DbInfo(value = "sys_role", comment = "角色")
public class SysRole extends TreeNode<SysMenu> implements Serializable {

	@PrimaryKey
    @Exist(classes = {SysRoleUserDao.class},
            fields = {"roleId"},
            groups = {DeleteGroup.class})
	private Long id;

	private Long pid;

	private String 	pids;

	/**
	 * 父角色名称
	 */
	@FillField(type = FillType.ONE_FIELD_IN, entity = SysRole.class, outField = "name", inField = "pid", defaultQueryIt = true)
	@TableField(false)
	private String parentName;

	/**
	 * 角色名称
	 */
	@Uniqueness(message = "角色名称不可相同", groups = {AddGroup.class, UpdateGroup.class})
	private String name;
	/**
	 * 备注
	 */
	private String remark;
	/**
	 * 部门ID
	 */
	private Long deptId;
	/**
	 * 更新者
	 */
	private Long updater;
	/**
	 * 更新时间
	 */
	private Date updateDate;



	/**
	 * 创建者
	 */
	private Long creator;
	/**
	 * 创建时间
	 */
	private Date createDate;

	/**
	 * 角色菜单列表
	 */
	@TableField(false)
	private List<SysRoleMenu> roleMenuList;

	/**
	 * 减量菜单id列表
	 * @return
	 */
	@TableField(false)
	private List<String> delMenuIdList;

	public List<SysRoleMenu> getRoleMenuList() {
		return roleMenuList;
	}

	public void setRoleMenuList(List<SysRoleMenu> roleMenuList) {
		this.roleMenuList = roleMenuList;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getParentName() {
		return parentName;
	}

	public void setParentName(String parentName) {
		this.parentName = parentName;
	}

	public String getPids() {
		return pids;
	}

	public void setPids(String pids) {
		this.pids = pids;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Long getDeptId() {
		return deptId;
	}

	public void setDeptId(Long deptId) {
		this.deptId = deptId;
	}

	public Long getUpdater() {
		return updater;
	}

	public void setUpdater(Long updater) {
		this.updater = updater;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public Long getCreator() {
		return creator;
	}

	public void setCreator(Long creator) {
		this.creator = creator;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Override
	public Long getPid() {
		return pid;
	}

	@Override
	public void setPid(Long pid) {
		this.pid = pid;
	}

	public List<String> getDelMenuIdList() {
		return delMenuIdList;
	}

	public void setDelMenuIdList(List<String> delMenuIdList) {
		this.delMenuIdList = delMenuIdList;
	}
}
